﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
   
    <title>CodeIgniter ACI Read</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <script type="text/javascript" src="http://localhost/ci3/lib/jquery-3.2.1.min.js"></script>

	<style>
	*{
	margin:0px;
	padding:0px;
	
	}
		body{
			text-align: center;
		}
		
		li{
		list-style:none;
		}
		#border{
			text-align: left;			
			margin-left:auto; 
			margin-right:auto; 			
		width: 1024px; 
		}
		#border2{
		float:left;
		
		width: 1024px; 
			box-shadow: 10px 10px 5px #888888;
		}
		#header{ 
			margin: 0px; 
			line-height: 150px;
			background: #888888;
		}
		#menu{ 
			background: silver;
			line-height:50px;
			height: 50px;
		}
		.MainContent{  
 
			
			margin-left:10px;
		}
		 
		 .row{
		 border-bottom:1px dashed #f2f2f2;
		 }
		 rowadmin{
		  font-size:14px;
		  background:#f1f1f1;
		  line-height:40px;
		  }
		  
		  /*CSS yahoo2 style pagination*/

	DIV.yahoo2 {
	PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-SIZE: 0.85em; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; FONT-FAMILY: Tahoma,Helvetica,sans-serif; TEXT-ALIGN: center
	}
	DIV.yahoo2 A {
	BORDER-RIGHT: #ccdbe4 1px solid; PADDING-RIGHT: 8px; BACKGROUND-POSITION: 50% bottom; BORDER-TOP: #ccdbe4 1px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ccdbe4 1px solid; COLOR: #0061de; MARGIN-RIGHT: 3px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccdbe4 1px solid; TEXT-DECORATION: none
	}
	DIV.yahoo2 A:hover {
	BORDER-RIGHT: #2b55af 1px solid; BORDER-TOP: #2b55af 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #2b55af 1px solid; COLOR: #fff; BORDER-BOTTOM: #2b55af 1px solid; BACKGROUND-COLOR: #3666d4
	}
	DIV.yahoo2 A:active {
	BORDER-RIGHT: #2b55af 1px solid; BORDER-TOP: #2b55af 1px solid; BACKGROUND-IMAGE: none; BORDER-LEFT: #2b55af 1px solid; COLOR: #fff; BORDER-BOTTOM: #2b55af 1px solid; BACKGROUND-COLOR: #3666d4
	}
	DIV.yahoo2 SPAN.current {
	PADDING-RIGHT: 6px; PADDING-LEFT: 6px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; COLOR: #000; MARGIN-RIGHT: 3px; PADDING-TOP: 2px
	}
	DIV.yahoo2 SPAN.disabled {
	DISPLAY: none
	}
	DIV.yahoo2 A.next {
	BORDER-RIGHT: #ccdbe4 2px solid; BORDER-TOP: #ccdbe4 2px solid; MARGIN: 0px 0px 0px 10px; BORDER-LEFT: #ccdbe4 2px solid; BORDER-BOTTOM: #ccdbe4 2px solid
	}
	DIV.yahoo2 A.next:hover {
	BORDER-RIGHT: #2b55af 2px solid; BORDER-TOP: #2b55af 2px solid; BORDER-LEFT: #2b55af 2px solid; BORDER-BOTTOM: #2b55af 2px solid
	}
	DIV.yahoo2 A.prev {
	BORDER-RIGHT: #ccdbe4 2px solid; BORDER-TOP: #ccdbe4 2px solid; MARGIN: 0px 10px 0px 0px; BORDER-LEFT: #ccdbe4 2px solid; BORDER-BOTTOM: #ccdbe4 2px solid
	}
	DIV.yahoo2 A.prev:hover {
	BORDER-RIGHT: #2b55af 2px solid; BORDER-TOP: #2b55af 2px solid; BORDER-LEFT: #2b55af 2px solid; BORDER-BOTTOM: #2b55af 2px solid
	}
	
	 
		  
	</style>
</head>

<body>

<div id="border">
<div id="border2">

	<div id="header"> 
	<h1>CodeIgniter ACI Read</h1>
	</div>
	<div id="menu">
		<h2>
		<a href=http://localhost/ci3/index.php/account/index> Index </a>  | <a href=http://localhost/ci3/index.php/account/insert> Insert </a>
		</h2>
</div>


	<div class="MainContent">
	

	<div class="yahoo2"><?php echo $this->pagination->create_links(); ?></div>
	
	 
	<input type="checkbox" id="ckb_selectAll" onclick="selectAll()" title="选中/取消选中">
	<a href="javascript:void(0);" onclick="del_()" title="删除选定数据" style="font-weight:normal">删除</a>

	<?php 
	foreach ($query as $row){ 
		echo  "<div class=row><ul>"."<li>".$row->id."</li>"."<li>".$row->username."</li>"."<li>".$row->password."</li>"."<li>".$row->email."</li>"."<li><div class=rowadmin> "."    <a href= http://localhost/ci3/index.php/account/itemlist/$row->id> List </a> &nbsp  &nbsp   "."    <a href= http://localhost/ci3/index.php/account/delete/$row->id> Delete </a> &nbsp&nbsp    <a href= http://localhost/ci3/index.php/account/update/$row->id> Update </a> "."</div></li> "."</ul></div> "."\n"
 ;

	?>


	<input type="checkbox" class="ckb" id="<?php echo $row->id;?>" value="<?php echo $row->id;?>">
	<hr size=1>
 
	<?php

	}
	?> 
	</div>

</div>
</div>

<script>

function selectAll() {
  if ($('#ckb_selectAll').is(':checked')) {
    $(".ckb").attr("checked", true); //全部选中
  } else {
    $(".ckb").attr("checked", false);//全部取消
  }
}
 

function del_() {
  var ids = '';
  $(".ckb").each(function() {
    if ($(this).is(':checked')) {
      ids += ',' + $(this).val(); //逐个获取id
    }
  });
  ids = ids.substring(1); // 对id进行处理，去除第一个逗号
  if (ids.length == 0) {
    alert('请选择要删除的选项');
  } else {
    if (confirm("确定删除？删除后将无法恢复。")) {
      url = "ids=" + ids;
      alert(url);
      $.ajax({
        type: "GET",
       	url: "<?PHP echo base_url().index_page().$this->uri->slash_segment(1,'both').'delall';?>",
      //  url: "/codep2.php",
        dataType:'json',
        data: url, 
              success:function(result) {
                    if(result.counts == 1) {


                       alert(result.counts+result.des+result.ids);
                    	//alert(result.counts);
                    	//alert(result.des);
                       // obj.parents('form').submit(); //验证码正确提交表单
                    }else{
                       alert(result.counts+result.des+result.ids);
                    	 
                    }
                },
                error: function(XMLHttpRequest, textStatus) {
        	  alert("页面请求错误，请检查重试或联系管理员！\n" + textStatus);
       		 }


      });
    }
  }
}
 

</script>



</body>
</html>